package org.anti996.bankms.util;

import org.anti996.bankms.Configure;

public class MessageUtil {
    public static void warning(String content) {
        System.out.println((char) 27 + "[43m警告：" + content + (char) 27 + "[0m");
    }

    public static void error(String content) {
        System.out.println((char) 27 + "[41m错误：" + content + (char) 27 + "[0m");
    }

    public static void success(String content) {
        System.out.println((char) 27 + "[42m" + content + (char) 27 + "[0m");
    }

    public static void infoln(String content) {
        System.out.println("> " + content);
    }

    public static void info(String content) {
        System.out.print("> " + content);
    }

    public static void title(String content) {
        String stars = "*".repeat((Configure.SCREEN_WIDTH - content.length()) / 2);
        System.out.println(stars + " " + content + " " + stars);
    }

    public static void itemList(String[] contents) {
        for (int i = 0; i < contents.length; i++) {
            System.out.printf("\t %d.%s\n", i + 1, contents[i]);
        }
    }
}
